<?php

namespace App\Models;



class CustomerProduct extends ApiBaseModel
{

    protected $table = 'cz_customer_product';
    protected $fillable = [
        'product_id',
        'spec_id',
        'user_id',
        'user_price',
        'channel_group_id',
        'sort_type',
        'is_loop',
        'channels_id',
        'channels',
        'create_by',
        'update_by',
        'timeout',
        'submit_order_count'
    ];




    public function product()
    {
        return $this->belongsTo(CzProduct::class, 'product_id', 'id');
    }
    public function user()
    {
        return $this->belongsTo(SysUser::class, 'user_id', 'id');
    }
    public function spec()
    {
        return $this->belongsTo(CzSpec::class, 'spec_id', 'id');
    }
    public function channel_group()
    {
        return $this->belongsTo(ChannelGroup::class, 'channel_group_id', 'id');
    }
    public function channels()
    {
        return $this->hasMany(CustomerProductChannel::class, 'customer_product_id', 'id');
    }
}
